/ leetcodesolve / 1910. Remove All Occurrences of a Substring.py
swadhinbiswas solve more problem · 5/11/2025
8bcf412
11 lines · 217 Bytes
1
2
3
4
5
6
7
8
9
10
11
 #problem
 #1910. Remove All Occurrences of a Substring
 # solve

class Solution:
    def removeOccurrences(self, s: str, part: str) -> str:
        while part in s:
          s=s.replace(part,"",1)
        return s